import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nft_shop/box/conteroller/Invite_box_controller.dart';
import 'package:nft_shop/widgets/load_image.dart';

class DialogOpenBox extends StatelessWidget {
  late String ID;
  VoidCallback? onCall;
  DialogOpenBox({Key? key,required this.ID,this.onCall}) : super(key: key);

  InviteBoxController controller = InviteBoxController.to;

  @override
  Widget build(BuildContext context) {
    final Widget content = Material(
        color: Colors.transparent,
        child: Column(
          children: [
            Container(
              width: double.infinity,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text("恭喜您获得",style: TextStyle(fontSize: 18,color:Color(0xFFFFFFFF),),),
                  SizedBox(height: 6,),
                  Text("1个盲盒",style: TextStyle(fontSize: 36,color:Color(0xFFFFFFFF),),),
                  SizedBox(height: 10,),
                  LoadAssetImage("box",width: 196,),
                  SizedBox(height: 10,),
                  InkWell(
                    onTap: onCall,
                    child: Container(
                      padding: EdgeInsets.symmetric(horizontal: 55,vertical: 10),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(100),
                        gradient: LinearGradient(colors: [
                          Color(0xFFF7D39D),
                          Color(0xFFFDC360),
                        ], begin: Alignment.centerLeft, end: Alignment.centerRight),
                      ),
                      child: Text("去拆盲盒",style: TextStyle(fontSize: 18,color: Color(0xFFA74706)),),
                    ),
                  ),
                ],
              ),
            ),

          ],
        )
    );

    final Widget body = MediaQuery.removeViewInsets(
      removeLeft: true,
      removeTop: true,
      removeRight: true,
      removeBottom: true,
      context: context,
      child: Center(
        child: InkWell(
          onTap: (){
            Get.back();
          },
          child: Container(
            child: SizedBox(
              width: Get.width - 50,
              height: 330,
              child: content,
            ),
          ),
        ),
      ),
    );

    return AnimatedPadding(
      padding: MediaQuery.of(context).viewInsets,
      duration: const Duration(milliseconds: 120),
      curve: Curves.easeInCubic, // easeOutQuad
      child: body,
    );
  }
}
